#!/bin/sh -e

ROOTDEV="$(cat /proc/cmdline | grep -Eo 'root=[^ ]+' | cut -c 6-)"
if [ -z "$ROOTDEV" ] ; then
    echo "Error: Unable to detect ROOTDEV"
    exit 1
fi

sed -i  's|rootdev=.*|rootdev='"$ROOTDEV"'|' /boot/armtixEnv.txt

mkimage -A arm64 -O linux -T ramdisk -C gzip -n uInitrd -C gzip -d /boot/initramfs-linux-rockchip-rk3588.img /boot/uInitrd-linux-rockchip-rk3588
